<?php
    session_start();
    include_once '../../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
    $oid = $_REQUEST['oid'];
  
        $count="select COUNT(*)as resp from lbseguimiento where hcnsolexa = '".$oid."'";
        $res = $con->query($count);
        
        while($res2 = mssql_fetch_array($res)){
            $resp = $res2['resp'];
        }
        if($resp == 0){
            $insert = "insert into lbseguimiento (hcnsolexa,segfactura,segfacfecha,usu_oidf)values('".$oid."','1',GETDATE(),'".$_SESSION['usuario']."')";
            $con->query($insert);
        }else{
            $update = "update lbseguimiento
                        set segfactura ='1',
                        segfacfecha = GETDATE(),
                        usu_oidf = '".$_SESSION['usuario']."'
                       where hcnsolexa = '".$oid."'";
            $con->query($update);
        }
    $con->cerrarConexion();
    
 
?>